
#include <iostream>

using namespace std;

int num[10] = {1,2,3,4,5,6,7,8,9,0};
int nums[3] = {11,12,13};
int num2[10] = {21,22,23,24,25,26,27,28,29,30};

int load(char* buf)
{
	int len = 0;
	bcopy(buf,num,sizeof(num));
	len += sizeof(num);
	buf += len;
	bcopy(buf,nums,sizeof(nums));
	len += sizeof(nums);
	buf += sizeof(nums);
	return len;
}
int save(char* buf)
{
	int len = 0;
	bcopy(num,buf,sizeof(num));
	len += sizeof(num);
	buf += len ;
	bcopy(nums,buf,sizeof(nums));
	len += sizeof(nums);
	buf += sizeof(nums);
	return len;
}

int load2(char* buf)
{
	int len = 0;
	bcopy(buf,num2,sizeof(num2));
	len += sizeof(num2);
	return len;
}
int save2(char* buf)
{
	int len = 0;
	bcopy(num2,buf,sizeof(num2));
	len += sizeof(num2);
	buf += sizeof(num2);
	return len;
}

void oper(char* buf)
{
	int len = 0;
	int length = 10;
	*(int*)buf = length;
	len += sizeof(length);
	len += save(buf + len);
	len += save2(buf + len);
}

void opensss(char* buf)
{
	int length = *(int*)buf;
	buf += sizeof(length);
	buf += load(buf);
	buf += load2(buf);
	for(int i = 0; i < 10; i++)
	{
		cout<<num2[i]<<" ";
	}
	cout<<endl;

}
int test(char * buf)
{
	buf += 10;
	char* pstr = "ffff";
	bcopy(pstr,buf,sizeof(pstr));
}
int main()
{
	char buf[100];
	oper(buf);
	bzero(num2,sizeof(num2));
	opensss(buf);
	char bufs[100] = "fuck you!!!";
	cout<<&bufs<<endl;
	test(bufs);
	cout<<&bufs<<endl;
	char* pstr = bufs;
	pstr += 10;
	cout<<pstr<<endl;
	cout<<bufs<<endl;
	return 0;
}



